<template>
    <div class="item-one">
        <div class="title">
            <span>商户充值</span>
        </div>
        <div class="container">
            <el-form :model="rechargeForm" :rules="rules" ref="rechargeForm" label-width="100px" class="demo-ruleForm">
            <el-form-item label="充值金额" prop="money">
                <el-input v-model.number="rechargeForm.money" placeholder="请输入充值金额"></el-input>
            </el-form-item>
            <el-form-item class="btn">
                <el-button type="primary" @click="submitForm" style="width:120px;height:40px;font-size:18px;margin-top:30px;">立即充值</el-button>
                <!-- <el-button @click="resetForm">重置</el-button> -->
            </el-form-item>
            </el-form>
        </div>
    </div>
</template>

<script>
export default {
    name: 'item-one',

    data() {
        return {
            rechargeForm: {},
            rules: {
                money: [
                    { required: true, message: '充值金额不能为空'},
                    { type: 'number', message: '充值金额必须为数字值'}
                ]                   
            }
        };
    },

    created() {

    },

    methods: {
        // 重置表单
        // resetForm() {
        //     this.$refs.rechargeForm.resetFields()
        // },
        // 提交
        submitForm() {
            this.$refs.rechargeForm.validate(valid => {
                if(!valid) return this.$message.error('请检查输入内容')
                console.log(this.rechargeForm);
                this.$refs.rechargeForm.resetFields()
            })
        }
    },
};
</script>

<style lang="less" scoped>
.title {
  background: #fff;
  padding: 10px 10px;
  font-size: 18px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
}
.demo-ruleForm{
    margin: 0 auto;
    margin-top: 50px;
    width: 800px;
}
/deep/.el-input__inner{
    height: 45px;
}
/deep/.el-form-item__label{
    line-height: 45px;
}
/deep/.btn .el-form-item__content{
    margin-left: -100px !important;
    text-align: center;
}
</style>